package com.fastjrun.eladmin.itrms.service.impl;

import com.fastjrun.eladmin.itrms.dao.SysUserDao;
import com.fastjrun.eladmin.service.BaseService;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import javax.annotation.Resource;
import java.util.Iterator;

public abstract class BaseItrmsService extends BaseService {
    protected static final Integer PAGE_CURRENT=1;
    protected static final Integer PAGE_SIZE=10;

    @Resource
    SysUserDao sysUserDao;

    protected String getOrderClause(Pageable pageable) {
        StringBuilder orderClauseSB = new StringBuilder();
        Iterator<Sort.Order> iterable = pageable.getSort().iterator();
        while (iterable.hasNext()) {
            Sort.Order order = iterable.next();
            if (orderClauseSB.length() > 0) {
                orderClauseSB.append(",");
            }
            orderClauseSB.append(order.getProperty());
        }
        return orderClauseSB.toString();
    }
}
